<%@ Page Title="Clients" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" 
	Inherits="System.Web.Mvc.ViewPage<IPagination<ETestIT.Core.Client>>" %>
<%@ Import Namespace="MvcContrib.UI.Pager"%>
<%@ Import Namespace="MvcContrib.Pagination"%>
<%@ Import Namespace="ETestIT.Web.Presentation"%>
<%@ Import Namespace="MvcContrib.UI.Grid"%>
<%@ Import Namespace="ETestIT.Core" %>
<%@ Import Namespace="ETestIT.Web.Controllers" %>
<%@ Import Namespace="MvcContrib.UI.Grid.ActionSyntax" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentTitlePlaceHolder" runat="server">
    <h2>Clients</h2>
</asp:Content>


<asp:Content ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

    <% if (ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] != null) { %>
        <p id="pageMessage"><%= ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()]%></p>
    <% } %>

    <div>
        <%= Html.ActionImage<ClientsController>(c => c.Create(), "content/images/add.ico", "Create New Client", null, null, new { @class = "add" })%>
        <% Html.Grid(Model).Columns(column =>
        {
        column.For(x => x.Name);
        column.For(x => x.ContactInformation);
        column.For(x => x.TypeOfClient);
        column.For("Actions").Named("Actions").Action(p =>
               {%><td>
                    <% var fid = Guid.NewGuid();
                       using (Html.BeginForm<ClientsController>(c => c.Delete(p.Id), FormMethod.Post, new { id = fid }))
                       { %><%= Html.AntiForgeryToken()%>
                        <%=Html.ActionImage<ClientsController>(c => c.Show(p.Id), "content/images/view.ico", "Details ")%>
                        <%=Html.ActionImage<ClientsController>(c => c.Edit(p.Id), "content/images/edit.ico", "Edit")%>
                        <a href="#" onclick="ConfirmeDialog('<%= fid %>'); return false;" ><img src="content/images/delete.ico" alt=""/></a>
                    <% } %>
                  </td><%});
        }).Attributes(@class => "grid", width => 770).RenderUsing(new FooterTableGridRender<Client>()).Render();%>
        <br />
        <%= Html.Pager(Model) %>
    </div>
    
</asp:Content>
